<template>
	<view :class="lang">
		<u-navbar :is-back="false" :is-fixed="true" :title="$t('通用驾考')"></u-navbar>
		<view class="daojishibox" v-if="tiyanshow">
			<view class="daojitxt daojitxt-yt">体验时间：</view>
			<view class="daojitxt">
				<u-count-down ref="uCountDown" :autoplay="true" :timestamp="tiyan_time" :show-days="false"
					:show-hours="false" @end="tiyanend()" @change="changetime"></u-count-down>
			</view>
		</view>
		<view class="u-page">
			<view class="wrap">
				<!-- 语言 类型 年份选择 -->
				<view class="select-type">
					<!-- 语言 -->
					<view class="select-lang type ">
						<view v-if="lang == 'cn'" class="text" @click="handlelangSelect">
							{{langList[langIndex]}}
							<image class="select-img"
								src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/bottom.png">
							</image>
						</view>
						<view v-else class="text" style="padding-top: 8rpx;" @click="handlelangSelect">
							{{langList[langIndex]}}
							<image class="select-img"
								src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/bottom.png">
							</image>
						</view>
						<view v-show="langtypeFLag" class="typebox">
							<view class="typeboxitem" v-for="(item,index) in langList" @click="langSelect(item,index)"
								:style="{fontFamily: lang == 'cn' ? 'ALKATIP Tor Tom' : 'ALKATIP Tor Tom'}">
								{{item}}
							</view>
						</view>
					</view>
					<!-- 选择考试类型 -->
					<view class="select-class type">
						<view v-if="lang == 'cn'" class="text" @click="handlecartSelect">
							{{zgzList[classIndex]}}
							<image class="select-img"
								src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/bottom.png">
							</image>
						</view>
						<view v-else class="text" style="padding-top: 8rpx;" @click="handlecartSelect">
							{{zgzList[classIndex]}}
							<image class="select-img"
								src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/bottom.png">
							</image>
						</view>
						<view v-show="carttypeFlag" class="typebox">
							<view v-if="lang == 'cn'" class="typeboxitem" v-for="(item,index) in zgzList"
								@click="classSelect(item,index)">
								{{item}}
							</view>
							<view v-if="lang == 'uy' || lang == 'kz'" class="typeboxitem drl"
								v-for="(item,index) in zgzList" @click="classSelect(item,index)">
								{{item}}
							</view>
						</view>
					</view>
					<!-- 题库年份选择 -->
					<view class="select-year type">

						<view v-if="lang == 'cn'" class="text" @click="handleyearSelect">
							{{yearList[yearIndex]}}
							<image class="select-img"
								src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/bottom.png">
							</image>
						</view>
						<view v-else class="text" style="padding-top: 8rpx;" @click="handleyearSelect">
							{{yearList[yearIndex]}}
							<image class="select-img"
								src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/bottom.png">
							</image>
						</view>
						<view v-show="yeartypeFlag" class="typebox">
							<view class="typeboxitem" v-for="(item,index) in yearList" @click="yearSelect(item,index)">
								{{item}}
							</view>
						</view>
					</view>
				</view>

				<view class="banner">
					<u-toast ref="uToast"></u-toast>
					<u-swiper @change="change" :height="200" :list="bannerlist" :title="title" :effect3d="effect3d"
						:indicator-pos="indicatorPos" :mode="mode" :interval="3000"></u-swiper>
				</view>
				<scroll-view scroll-y style="height: 100%;width: 100%;">
					<view class="kemuone">
						<view class="kemuone-left">
							<view class="left-box" @click="mlink('recite')">
								<image class="left-img"
									src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/bt.png">
								</image>
								<view class="left-text">{{ $t('indexs.背题模式') }}</view>
							</view>
							<view class="left-box" @click="mlink('guidepost')">
								<image class="left-img"
									src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/jt.png">
								</image>
								<view class="left-text">{{ $t('indexs.交通标志') }}</view>
							</view>
							<view class="left-box" @click="wrongslink()">
								<image class="left-img"
									src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/ct.png">
								</image>
								<view class="left-text">{{ $t('indexs.错题收藏') }}</view>
							</view>
						</view>

						<view class="kemuone-bot">
							<view class="bot-box" @click="mlink('practice')">
								<image class="bot-img"
									src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/lx.png">
								</image>
								<view class="kemuone-bot-lx twoviewtext pt90">
									<view class="kemuone-bot-lxnum">
										<text>{{ compentcount }}/{{ allcount }}</text>
									</view>
									<view class="kemuone-bot-lxtext">
										<text>{{ $t('indexs.循序练习') }}</text>
									</view>
								</view>
							</view>
							<view class="bot-box" @click="mlink('exam')">
								<image class="bot-img"
									src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/ks.png">
								</image>
								<view class="kemuone-bot-lx twoviewtext pt90">
									<view v-if="lang == 'cn'" class="kemuone-bot-lxnum">
										<text>{{examkemu == 0 ? $t('indexs.无成绩') :  examkemu + $t('resultstxt.分') }}</text>
									</view>
									<view v-else class="kemuone-bot-lxnum" style="direction: rtl;">
										<text>{{examkemu == 0 ? $t('indexs.无成绩') :  examkemu + $t('resultstxt.分') }}</text>
									</view>
									<view class="kemuone-bot-lxtext">
										<text>{{ $t('indexs.模拟考试') }}</text>
									</view>
								</view>

							</view>
						</view>

						<view class="kemuone-left">
							<view class="left-box" @click="mlink('examrecord')">
								<image class="left-img"
									src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/cj.png">
								</image>
								<view class="left-text">{{ $t('indexs.考试成绩') }}</view>
							</view>
							<view class="left-box" @click="mlink('about')">
								<image class="left-img"
									src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/tool5.png">
								</image>
								<view class="left-text">{{ $t('indexs.商务合作') }}</view>
							</view>
							<view class="left-box" @click="mlink('winnow')">
								<image class="left-img"
									src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/jx.png">
								</image>
								<view class="left-text">{{ $t('indexs.精选500') }}</view>
							</view>
						</view>
					</view>

				</scroll-view>

			</view>
		</view>
		<!-- activaModalshow -->
		<u-popup class="pop1" v-model="activaModalshow" mode='center' width='590rpx' height='1070rpx'
			:mask-close-able="false" @close="handleActive">
			<view class="content" :class="[lang !== 'cn' ? 'heigt-over' :'']">
				<image class="content-imgbg"
					src="https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/activebg.png"></image>
				<view class="content-box">
					<view class="title">
						{{ $t('activateion.activatesoft') }}
					</view>
					<view class="usernum">
						<view class="lable">{{ $t('activateion.usernum') }}</view>
						<input type="number" class="usernum-input" @input="onkahao" :value="kahaonum" />
					</view>
					<view class="usernum">
						<view class="lable">{{ $t('activateion.password') }}</view>
						<input type="number" password="true" class="usernum-input" @input="onkami" :value="kaminum" />
					</view>
					<view class="active" @click="onaction(0)">
						{{ $t('activateion.action') }}
					</view>
					<view class="tiaoli">
						<label @click="setDoamin">
							<checkbox :checked="racheck" class="mycheck" style="transform:scale(0.7)" />
							<text>{{ $t('activateion.agree') }}</text>
						</label>
					</view>
					<view class="box_1 flex-row justify-between">
						<view class="image_2"></view>
						<text class="text_5">{{ $t('activateion.其他功能') }}</text>
						<view class="image_3"></view>
					</view>
					<view class="shiyong-jihuo">
						<view class="shiyong btn" @click="link('ontrial')">
							{{ $t('activateion.ontrial') }}
						</view>
						<view class="jihuo btn" @click="link('buycode')">
							{{ $t('activateion.buycode') }}
						</view>
					</view>
					<view class="tuixiaoyuan" @click="link('/ucenter/shopcart')">
						{{ $t('activateion.agent') }}
					</view>
				</view>
				<view class=""
					style="position: absolute; bottom: 0; margin-top: 150rpx; left: 50%; margin-left: -28rpx;">
					<u-icon name="close-circle" color="#ffffff" size="56" @click="handleCloseactive"></u-icon>
				</view>
			</view>
		</u-popup>
		<u-popup ref="popup1" class="popup" v-model="wxloginshow" :round="30" mode="bottom" :mask-close-able="false"
			:maskClick='false'>
			<view class="loginBox">
				<view class="btnBox">
					<view class="loginbtnk">
						<button class="weichat" open-type="getUserInfo" @click="wxlogin()">
							<u-icon name="weixin-fill" color="#ffffff"></u-icon>
							<text>微信登陆</text>
						</button>
					</view>

					<!-- #ifdef APP-PLUS -->
					<view v-show="loginshenhe" class="loginbtnk-apple" @click="applogin()">
						<image class="apple-img" src="/static/appleid_button.png"></image>
					</view>
					<!-- #endif -->
				</view>


				<!-- <view class="redtext" @click="openweb">
					{{ $t('activateion.regulations') }}
				</view> -->
				<view v-if="lang == 'cn'" class="login-check" style="text-align: center; width:50%;">
					<view style="display: flex; align-items: center; ">
						<u-checkbox-group @click="setDoamin">
							<u-checkbox v-model="racheck" style="transform:scale(1)"
								@change="checkboxChange"></u-checkbox>
						</u-checkbox-group>
						<view class="redtext" @click="openweb">
							{{ $t('activateion.regulations') }}
						</view>
					</view>
				</view>
				<view v-else class="login-check" style="text-align: center; width:70%;">
					<view style="display: flex; align-items: center; ">
						<view class="redtext" @click="openweb">
							{{ $t('activateion.regulations') }}
						</view>
						<u-checkbox-group @click="setDoamin">
							<u-checkbox v-model="racheck" style="transform:scale(1)"
								@change="checkboxChange"></u-checkbox>
						</u-checkbox-group>
					</view>
				</view>
			</view>

		</u-popup>


		<paybox :show="show"></paybox>

		<u-tabbar v-model="tabcurrent" icon-size='40' :list="tabbarlist" :mid-button="false" active-color="#0895FB"
			:before-switch="beforeSwitch"></u-tabbar>
	</view>
</template>

<script>
	//#ifdef APP-PLUS
	import {
		isOpen,
		openDb,
		addTab,
		mergeSql,
		getDataList,
		addTabItem,
		closeSQL,
		deleteInformationType,
		getTable,
		getCount,
		updateSQL,
		isTable,
		selectDataList
	} from '@/js_sdk/lyz-sqlite/index.js';
	//#endif
	import {
		getCarType,
		getArrEqual,
		getArrload
	} from '../../common/savetool.js';
	import paybox from '@/components/paybox/paybox.vue';
	import indexsetting from '@/components/index-setting/index-setting.vue';

	import {
		jihuo_api,
		wxlogin_api, //微信登陆接口
		wxminilogin_api,
		tikucounts_api,
		guanggao_api, //广告接口
		cuotilist_api, //错题收藏列表
		tikuindex_api,
		jingxuan_api,
		userInfo_api

	} from '@/api/index';


	export default {
		components: {
			paybox, //支付模块
			indexsetting, //科目选择模块
		},
		data() {
			return {
				moniFlag: true,
				racheck: false,
				kahaonum: "",
				kaminum: "",
				activaModalshow: false,
				wxloginshow: false,
				langtypeFLag: false,
				carttypeFlag: false,
				yeartypeFlag: false,
				lang: this.$i18n.locale,
				langList: [this.$t('settings.中文'), this.$t('settings.哈萨克语'), this.$t('settings.维吾尔语')],
				jszList: ['C1/C2/C3', 'D/E/F', 'A1/A3/B1', 'A2/B2'],
				zgzList: [this.$t('indexs.货运'), this.$t('indexs.客运'), this.$t('indexs.危险品')],

				yearList: ['2022', '2024'],
				langIndex: 0,
				classIndex: 0,
				yearIndex: 0,
				zzjz: 1, //驾驶证是0，资格证是1
				list: [{
						name: this.$t('indexs.科目一')
					},
					{
						name: this.$t('indexs.科目二')
					},
					{
						name: this.$t('indexs.科目三')
					},
					{
						name: this.$t('indexs.科目四')
					}
				],
				// 因为内部的滑动机制限制，请将tabs组件和swiper组件的current用不同变量赋值
				current: 0, // tabs组件的current值，表示当前活动的tab选项
				swiperCurrent: 0, // swiper组件的current值，表示当前那个swiper-item是活动的
				//bannerlist
				bannerlist: [{
						image: 'https://cdn.uviewui.com/uview/swiper/1.jpg',
						title: '昨夜星辰昨夜风，画楼西畔桂堂东'
					},
					{
						image: 'https://cdn.uviewui.com/uview/swiper/2.jpg',
						title: '身无彩凤双飞翼，心有灵犀一点通'
					},
					{
						image: 'https://cdn.uviewui.com/uview/swiper/3.jpg',
						title: '谁念西风独自凉，萧萧黄叶闭疏窗，沉思往事立残阳'
					}
				],
				title: false,
				mode: 'round',
				indicatorPos: 'bottomCenter',
				effect3d: false,
				//tabbar
				tabbarlist: [{
						text: this.$t('indexs.首页'),
						iconPath: "https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/icon1.png",
						selectedIconPath: "https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/icon1ed.png",
						customIcon: false,
					},
					{
						text: this.$t('indexs.我的'),
						iconPath: "https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/icon2.png",
						selectedIconPath: "https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/icon2ed.png",
						customIcon: false,
					}
				],
				tabcurrent: 0,
				show: false,
				closeable: true,
				closeIconPos: 'top-right',
				//选择季卡超级卡
				seasoncart: false,
				vipcart: false,
				payortype: false,
				cart_type: '',
				cart_types: '',
				buttontext: this.$t('indexs.选择卡类型'),
				kemu: 0, //资格证科目是0 表示的
				subject: '', //科目


				//顺序练习数量展示
				lolang: 'CN',
				allcount: null, //顺序练习总提数
				examkemu: 0, //模拟题成绩
				compentcount: 0, //顺序练习已看过的题
				workskemu: 0, //错题收藏数量 判断是否跳转到错题收藏
				tiyanshow: false, //体验开关
				tiyan_time: 120, //体验时间
				timestarts: false, //监听倒计时是否启动  默认不启动
				ontrial: false,
				tanchukuang: false, //判断弹出框是否弹出来  实现只弹出一个框
				year: "2023",
				loginshenhe: false, //判断手机类型
				experiencefalg: false
			};
		},
		onLoad(options) {
			// console.log(options);
			var that = this;
			that.ontrial = options.ontrial;
			try {
				const value = uni.getStorageSync('lang_key');
				//console.log("app onlaunch",value);
				if (value) {
					that.$i18n.locale = value;
					that.lang = value;
					if (value == 'cn') {
						that.lolang = 'CN';
						that.langIndex = 0
					}
					if (value == 'uy') {
						that.lolang = 'UG';
						that.langIndex = 2
					}
					if (value == 'kz') {
						that.lolang = 'KAZ';
						that.langIndex = 1
					}
				} else {
					uni.reLaunch({
						url: 'pages/setting/setting'
					});
				}
			} catch (e) {
				// error
				uni.reLaunch({
					url: 'pages/setting/setting'
				});
			}







			//判断科目来选择首页  做判断
			uni.getStorage({
				key: 'exam_type',
				success: function(res) {
					//console.log(res, '=====');
					//console.log(res.data);
					if (res.data == 'jiashizheng') {
						//console.log('tiao zhuan le ');
						uni.navigateTo({
							url: './index'
						});
					}
				}
			});

			//车型
			uni.getStorage({
				key: 'cart_type',
				success: function(res) {
					//console.log("cart types",res.data);
					// console.log("cart_type*********************", res, '=====');
					that.subject = getCarType(res.data);

					var types = res.data;
					// console.log('types66666666666666', types);
					that.cart_type = res.data;
					switch (types) {
						case '危险品':
							that.cart_types = that.$t('indexs.危险品');
							that.classIndex = 2
							break;
						case '客运':
							that.cart_types = that.$t('indexs.客运');
							that.classIndex = 1
							break;
						case '货运':
							that.cart_types = that.$t('indexs.货运');
							that.classIndex = 0
							break;
						default:
							that.cart_types = that.$t('indexs.货运');
							that.classIndex = 0
							break;
					}
					//that.subject = getCarType(res.data);
					// console.log('@@@@@@@@@@@');
					// console.log(getCarType(res.data));

					// 注释1
					// // #ifdef APP-PLUS
					// if (isOpen('data')) {
					// 	that.dbcount(that.kemu);
					// } else {
					// 	//数据库没有打开  先打开
					// 	console.log('数据库未打开');
					// 	that.openDb();
					// }
					// // #endif


				}
			});
			if (options.alert == 1) {
				that.show = true;
				//console.log('tanchu');
			}


			// 题库年份
			uni.getStorage({
				key: 'year_key',
				success: function(res) {
					// console.log("年份", res.data)
					if (res.data == "2022") {
						that.yearIndex = 0
					} else {
						that.yearIndex = 1
					}
				},
				fail() {
					that.$u.route({
						url: 'pages/setting/setting',
						params: {}
					});
				}
			});
			//查看有没有用户信息  如果没有显示activeModal登录
			uni.getStorage({
				key: 'user_infos',
				success: function(res) {
					// console.log("已经登陆了wwwwwwwwwwwwwwwwwwwwwwww", res)
					let userInfo = res.data
					that.wxloginshow = false
					that.racheck = true
					// let userstatus = res.data.userstatus
					// // console.log("显示弹框wwwwwwwwwwwwwwwwwwwwwwww", )
					// var ceshitime = uni.getStorageSync('tiyan_times');
					// // console.log("体验时间wwwwwwwwwwwwwwwwwwwwwwww",ceshitime )
					// if (ceshitime == 0) {
					// 	that.handleUserStatus(res.data.userstatus, res.data.jieshuriqi)
					// }
					that.http({
						url: userInfo_api,
						method: 'POST',
						header: {
							// 'content-type': 'application/x-www-form-urlencoded'
							'content-type': 'application/json'
						},
						data: {
							uid: uni.getStorageSync('user_infos').uid
						},
						success: userres => {
							console.log("接口用户信息000000000000000000000000", userres)
							let userstatus = userres.data.userstatus
							userInfo.userstatus = userres.data.userstatus
							uni.setStorageSync('user_infos', userInfo);
							// console.log("显示弹框wwwwwwwwwwwwwwwwwwwwwwww", )
							var ceshitime = uni.getStorageSync('tiyan_times');
							// console.log("体验时间wwwwwwwwwwwwwwwwwwwwwwww",ceshitime )
							if (ceshitime == 0) {
								that.handleUserStatus(userres.data.userstatus, userres.data
									.jieshuriqi)
							} else {

							}


						},

					})

				},
				fail() {
					that.activaModalshow = true
					that.wxloginshow = true
				}
			});

			//判断网络状态
			uni.getNetworkType({
				success: res => {
					//console.log("network--=", res);
					if (res.networkType == 'none') {
						this.isConnected = false;

					} else {
						this.isConnected = true;

						that.adlists();
					}
				}
			});

			uni.onNetworkStatusChange(res => {
				// console.log("net res=", res);

				this.isConnected = res.isConnected;
			});


			//console.log(options.ontrial, '******************');


			//广告接口


			// #ifdef MP-WEIXIN
			that.userstat();
			// #endif



			var userval = uni.getStorageSync('user_infos');
			if (Number(userval.userstatus) > 0) {
				that.tiyanshow = false;
				getApp().globalData.tiyan = 1;
				return false;
			}


			//判断机型
			var typeterminals = that.$kterminal;
			// console.log("typeterminals*****", typeterminals);

			if (typeterminals == 'android') {
				that.shenhe = true;
				that.loginshenhe = false;
			}
			if (typeterminals == 'ios') {
				that.loginshenhe = true;
			}





		},
		onShow() {
			var that = this;
			var that = this;
			try {
				const value = uni.getStorageSync('lang_key');
				//console.log("app onlaunch",value);
				if (value) {
					that.$i18n.locale = value;
					that.lang = value;
					if (value == 'cn') {
						that.lolang = 'CN';
					}
					if (value == 'uy') {
						that.lolang = 'UG';
					}
					if (value == 'kz') {
						that.lolang = 'KAZ';
					}
				} else {
					uni.reLaunch({
						url: 'pages/setting/setting'
					});
				}
			} catch (e) {
				// error
				uni.reLaunch({
					url: 'pages/setting/setting'
				});
			}
			//车型
			var localcarttype = uni.getStorageSync('cart_type');
			// console.log("cart_type*********************", localcarttype, '=====');

			switch (localcarttype) {
				case '危险品':
					that.cart_types = that.$t('settings.危险品');
					break;
				case '客运':
					that.cart_types = that.$t('settings.客运');
					break;
				case '货运':
					that.cart_types = that.$t('settings.货运');
					break;
				default:
					that.cart_types = that.$t('settings.货运');
					break;
			}

			var subjectname = getCarType(localcarttype);
			// console.log("subjectname+++++++++++++++++", subjectname)
			that.subject = subjectname;
			var tikualcount = uni.getStorageSync(subjectname + '_count_0');


			that.allcount = tikualcount;

			try {
				const value = uni.getStorageSync('lang_key');
				//console.log("app onlaunch",value);
				if (value) {
					that.$i18n.locale = value;
				} else {
					uni.reLaunch({
						url: 'pages/setting/setting'
					});
				}
			} catch (e) {
				// error
				uni.reLaunch({
					url: 'pages/setting/setting'
				});
			}


			uni.getStorage({
				key: 'kemu_type',
				success: function(res) {
					that.kemu = 0;


					//获取小程序数据
					var kemu = 0;
					var zzlx = '1'; //证件类型是0 驾驶证   1资格证
					that.minitikucount(zzlx, kemu);


					// 注释2
					//打开数据库
					// // #ifdef APP-PLUS
					// if (isOpen('data')) {
					// 	//数据库已打开
					// 	//console.log('数据库已打开');




					// 	that.dbcount(that.kemu);
					// 	//that.dbid(that.kemu);
					// 	//console.log('kemu', res.data);
					// } else {
					// 	//数据库没有打开  先打开
					// 	//console.log('数据库未打开');
					// 	that.openDb();
					// }
					// // #endif
				},
				fail() {
					that.$u.route({
						url: 'pages/setting/setting',
						params: {}
					});
				}
			});
			// uni.setNavigationBarTitle({
			// 	title: this.$t('ucenters.首页')
			// });


			uni.getStorage({
				key: 'user_infos',
				success: function(res) {
					let userInfo = res.data
					that.wxloginshow = false
					that.racheck = true

					that.http({
						url: userInfo_api,
						method: 'POST',
						header: {
							// 'content-type': 'application/x-www-form-urlencoded'
							'content-type': 'application/json'
						},
						data: {
							uid: uni.getStorageSync('user_infos').uid
						},
						success: userres => {
							console.log("接口用户信息000000000000000000000000", userres)
							let userstatus = userres.data.userstatus
							userInfo.userstatus = userres.data.userstatus
							uni.setStorageSync('user_infos', userInfo);
							// console.log("显示弹框wwwwwwwwwwwwwwwwwwwwwwww", )
							var ceshitime = uni.getStorageSync('tiyan_times');
							// console.log("体验时间wwwwwwwwwwwwwwwwwwwwwwww",ceshitime )
							if (ceshitime == 0) {
								that.handleUserStatus(userres.data.userstatus, userres.data
									.jieshuriqi)
							} else {

							}


						},

					})
				},
				fail() {
					// console.log("ppppppppppppppppppppppp")
					// that.activaModalshow = true
					var ceshitime = uni.getStorageSync('tiyan_times');
					if (ceshitime > 0) {
						that.tiyan_time = ceshitime
						that.tiyanshow = true
					} else {
						that.wxloginshow = true
					}

				}
			});



			//判断是否体验过？
			//如果会员 取消这个判断
			if (that.ontrial) {
				//console.log("jinru tiyan le ")
				that.checkty();
				var endtime = uni.getStorageSync('tiyan_times');
				//console.log("endtime",endtime);

				if (endtime === 0) {
					that.show = true;
				}


				if (getApp().globalData.tiyan == 2) {
					that.tiyanshow = true;
					var tytime = uni.getStorageSync('tiyan_times');
					that.tiyan_time = tytime;




					// //console.log(this.$refs.uCountDown.seconds);

					// var myVar = setInterval(function(){
					// 	if(that.tiyan_time - tytime>0){

					// 	}else{
					// 		clearInterval(myVar);
					// 	}

					// },1000}
				}
			} else {
				var userval = uni.getStorageSync('user_infos');
				if (Number(userval.userstatus) < 1) {
					var tytimes = uni.getStorageSync('tiyan_times');

					if (tytimes > 0) {
						that.tiyan_time = tytimes;
						that.tiyanshow = true;
					} else {
						that.tiyanshow = false;
					}
				} else {
					that.tiyanshow = false;
					getApp().globalData.tiyan = 1;
					// return false;
				}
			}



			//判断网络状态
			uni.getNetworkType({
				success: res => {
					//console.log("network--=", res);
					if (res.networkType == 'none') {
						this.isConnected = false;

					} else {
						this.isConnected = true;

						that.adlists();
					}
				}
			});


			// #ifdef MP-WEIXIN
			that.userstat();
			// #endif
		},
		onBackPress(options) {
			//#ifdef APP-PLUS
			if (uni.getSystemInfoSync().platform == 'ios') {
				plus.ios.import("UIApplication").sharedApplication().performSelector("exit")
			} else if (uni.getSystemInfoSync().platform == 'android') {
				// console.log("andriod exit")
				plus.runtime.quit();
			}
			//#endif

			if (options.from === 'navigateBack') {
				return false;
			}
			this.checkty();
			return false;



		},
		methods: {
			handleActive() {
				// console.log("关闭激活弹框")
				// console.log("tiyan_times", uni.getStorageSync('tiyan_times'))
				// console.log("jshenhe", uni.getStorageSync('jshenhe'))

				let status = parseInt(uni.getStorageSync('user_infos').userstatus)
				// console.log("status", status)
				let tiyan = uni.getStorageSync('tiyan_times')
				if (!this.experiencefalg) return
				if (status < 1 && tiyan === 0) {
					// console.log("3333")
					this.show = true
				}
			},
			handleCloseactive() {
				console.log("close")
				this.activaModalshow = false
				this.experiencefalg = false
			},
			checkboxChange(e) {},
			//隐私条例
			openweb: function() {
				// console.log("xieyixieyixieyi")
				var that = this;
				uni.navigateTo({
					url: '../template/index'
				});
			},
			// 苹果登录
			applogin: function() {
				var that = this;
				if (that.racheck === false) {
					uni.showModal({
						content: '请登陆前同意用户协议',
						showCancel: false,
						success: function() {
							// console.log("pppppppppppppppppp")
							that.racheck = true
						}
					});
					return false;
				} else {
					uni.showLoading({
						title: '加载中'
					});

					uni.login({
						provider: 'apple',
						success: function(loginRes) {
							// console.log("loginRes", loginRes)
							// 登录成功
							uni.getUserInfo({
								provider: 'apple',
								success(oauth) {
									// 获取用户信息成功

									// console.log('oauth info');
									// console.log(oauth);
									// console.log('oauth');
									// console.log(oauth);
									var openid = '';
									var name = 'apple';
									var famila = '';
									var email = '';
									var formdata = oauth.userInfo;

									openid = formdata.openId;
									if (formdata.fullName.giveName) {
										name = formdata.fullName.giveName;
									}
									if (formdata.fullName.familyName) {
										famila = formdata.fullName.familyName;
									}

									if (formdata.email) {
										email = formdata.email;
									}
									// var usrepic = siteurl + '/ios_logo.png';
									var usrepic = '/static/apple_button.png';

									// console.log(openid, name, famila, email);
									// console.log('formdata');
									// console.log(formdata);

									that.http({
										url: wxlogin_api,
										method: 'POST',
										header: {
											// 'content-type': 'application/x-www-form-urlencoded'
											'content-type': 'application/json'
										},
										data: {
											openid: openid,
											unionid: openid, //生成
											nick_name: name,
											pic_url: usrepic,
											sex: 1,
											gexing: null,
											devid: plus.device.uuid,

											system: 'stystemsios',
											system_info: 'system_infoios',
											version: '1.0.0',
											lang: that.lang,

											lastuptime: 0,
											apple_openid: openid,
											apple_name: name,
											apple_famila: famila,
											apple_email: email
											//苹果登录

											// unionid,
											// openid,
											// nick_name,	昵称
											// pic_url,
											// sex,		性别
											// gexing,		个性签名
											// devid,		硬件序列号
											// system,		设备类型:miniprog,android,iphone
											// system_info,	附加信息
											// version,	1.1.0	软件版本号
											// lastuptime,	上次题库更新时间戳
											// lang,		kz,ug,cn
											// apple_openid,
											// apple_name,
											// apple_famila,
											// apple_email
										},
										success: res => {
											// console.log(res);
											// console.log(JSON.stringify(res));
											//kaishiriqi --开始日期
											//jieshuriqi --结束日期
											// userstatus -- -3其他情况 -2到期 -1禁用 0-不是会员 1-普通会员 2-高级会员 3代理
											//存储openid
											uni.setStorageSync('openid', openid);

											var obj = JSON.parse(
												'{"openid":"' +
												openid +
												'","unionid": "' +
												openid +
												'","kaishiriqi":"' +
												res.kaishiriqi +
												'","jieshuriqi":"' +
												res.jieshuriqi +
												'","userstatus":"' +
												res.userstatus +
												'","jihuofangshi":"' +
												res.jihuofangshi +
												'","nick_name":"apple ","pic_url":"' +
												usrepic +
												'","uid":"' +
												res.uid +
												'","dailijibie":"' +
												res.dailijibie +
												'"}'
											);

											uni.setStorageSync('user_infos', obj);

											uni.showToast({
												title: '登陆成功',
												mask: false,
												duration: 1500
											});
											that.wxloginshow = false;
											// that.videolists()
											//判断是否激活过 如果激活过，跳转到首页，如果没没有激活，继续激活
											// userstatus -- -3其他情况 -2到期 -1禁用 0-不是会员 1-普通会员 2-高级会员 3代理
											var userstatus = res.userstatus;
											//var userstatus = -2;
											if (userstatus == -1) {
												that.activaModalshow = false
												//禁用状态
												// uni.showModal({
												// 	title: that.$t('jihuo.提示'),
												// 	content: that.$t(
												// 		'jihuo.您的账号已禁用'),
												// 	success: function(res) {
												// 		if (res.confirm) {
												// 			console.log(
												// 				'用户点击确定'
												// 			);
												// 		} else if (res
												// 			.cancel) {
												// 			console.log(
												// 				'用户点击取消'
												// 			);
												// 		}
												// 	}
												// });
												return false;
											}
											if (userstatus == -3) {
												that.activaModalshow = false
												//禁用状态
												// uni.showModal({
												// 	title: that.$t('jihuo.提示'),
												// 	content: that.$t(
												// 		'jihuo.您的账号已出现问题'),
												// 	success: function(res) {
												// 		if (res.confirm) {
												// 			console.log(
												// 				'用户点击确定'
												// 			);
												// 		} else if (res
												// 			.cancel) {
												// 			console.log(
												// 				'用户点击取消'
												// 			);
												// 		}
												// 	}
												// });
												return false;
											}
											if (userstatus == -2) {
												that.activaModalshow = false
												// console.log("simeng1111111111111111")
												//禁用状态
												// uni.showModal({
												// 	title: that.$t('jihuo.提示'),
												// 	content: that.$t(
												// 		'jihuo.您的账号已到期'),
												// 	success: function(res) {
												// 		if (res.confirm) {
												// 			console.log(
												// 				'用户点击确定'
												// 			);
												// 		} else if (res
												// 			.cancel) {
												// 			console.log(
												// 				'用户点击取消'
												// 			);
												// 		}
												// 	}
												// });
												return false;
											}
											if (userstatus == -1) {
												//禁用状态
												that.activaModalshow = false
												// uni.showModal({
												// 	title: that.$t('jihuo.提示'),
												// 	content: that.$t(
												// 		'jihuo.您的账号已禁用'),
												// 	success: function(res) {
												// 		if (res.confirm) {
												// 			console.log(
												// 				'用户点击确定'
												// 			);
												// 		} else if (res
												// 			.cancel) {
												// 			console.log(
												// 				'用户点击取消'
												// 			);
												// 		}
												// 	}
												// });
												return false;
											}

											if (userstatus == 0) {
												//普通用户
												that.activaModalshow = false
											}
											if (userstatus > 0) {
												//判断时间是否到？
												let timestamp = new Date().getTime();
												if (jieshuriqi < timestamp) {
													//时间到期
													if (that.isConnected == false) {
														uni.showModal({
															title: that.$t(
																'jihuo.提示'
															),
															content: that.$t(
																'jihuo.请联网后重新激活'
															),
															success: function(
																res) {
																if (res
																	.confirm
																) {
																	console
																		.log(
																			'用户点击确定'
																		);
																} else if (
																	res
																	.cancel
																) {
																	console
																		.log(
																			'用户点击取消'
																		);
																}
															}
														});
													} else {
														// console.log(
														// 	"simeng4444444444444444"
														// )
														uni.showModal({
															title: that.$t(
																'jihuo.提示'
															),
															content: that.$t(
																'jihuo.您的账号已到期'
															),
															success: function(
																res) {
																if (res
																	.confirm
																) {
																	console
																		.log(
																			'用户点击确定'
																		);
																} else if (
																	res
																	.cancel
																) {
																	console
																		.log(
																			'用户点击取消'
																		);
																}
															}
														});
													}
												} else {
													//激活弹框隐藏
													that.activaModalshow = false
													that.minitikucount(0, that.kemu)
													that.videolists()

												}
											}

										},
										fail: err => {
											// console.log(err);
										}
									});


								}
							});
						},
						fail: function(err) {
							// console.log("e=", err)
							// 登录失败
							uni.showModal({
								content: '登录失败！请用微信一键登录方式登录',
								showCancel: false
							});
						},
						complete: function() {
							uni.hideLoading();
						}
					});
				}
				// console.log('888');
				// 判断是 iOS13版本
			},

			//微信登陆
			wxlogin: function() {
				var that = this;

				if (that.racheck === false) {
					uni.showModal({
						content: '请登陆前同意用户协议',
						showCancel: false,
						success: function() {
							// console.log("pppppppppppppppppp")
							that.racheck = true
						}
					});
					return false;
				} else {
					uni.setStorageSync('racheck', 'true')
					that.anleanniu = false;



					// #ifdef MP-WEIXIN
					var devid = '100010010';
					var system_info = 'miniprogram'

					stystems = 'miniprog';
					uni.login({
						provider: 'weixin',
						success: function(loginRes) {
							// console.log("loginRes", loginRes);
							var code = loginRes.code;
							// console.log("code", code);



							that.http({
								url: wxminilogin_api,
								method: 'POST',
								header: {
									// 'content-type': 'application/x-www-form-urlencoded'
									'content-type': 'application/json'
								},
								data: {
									jscode: code
								},
								success: res => {
									// console.log("http", res);
									// console.log(JSON.stringify(res));
									//login_result: "{"session_key":"d3UnTWLvO6Uq3sbbkU8oKw==","openid":"oZelb44C11VsTsrAW_kAhi5Qcwt4","unionid":"oYR7U5yjBVOTr-PI09kMQ0k6iwBs"}"
									//存储openid
									// 获取openid后开启
									//that.usersetinfo(res,openid,true);
									var ures = JSON.parse(res.login_result);
									// console.log("ures=", ures);

									uni.getUserInfo({
										success: info => {
											// console.log("getUserInfo", JSON
											// 	.stringify(info));
											that.wxloginshow = false;

											var openids = ures.openid;
											var unionids = ures.unionid; //unionid
											// 与服务器交互将数据提交到服务端数据库
											that.http({
												url: wxlogin_api,
												method: 'POST',
												header: {
													// 'content-type': 'application/x-www-form-urlencoded'
													'content-type': 'application/json'
												},
												data: {
													openid: openids,
													unionid: unionids,
													nick_name: info
														.userInfo.nickName,
													pic_url: info.userInfo
														.avatarUrl,
													sex: info.userInfo
														.gender,
													gexing: null,
													devid: devid,
													system: stystems,
													system_info: system_info,
													version: '1.0.0',
													lastuptime: 0,
													lang: that.lang,

													apple_openid: null,
													apple_name: null,
													apple_famila: null,
													apple_email: null

												},
												success: resmm => {
													// console.log(
													// 	"resmm",
													// 	resmm);
													// console.log(JSON
													// 	.stringify(
													// 		resmm));
													info.unionid =
														unionids
													that.usersetinfo(
														resmm,
														openids,
														info, true,
														unionids);
													//存储openid
												},
												fail: err => {
													// console.log(err);
												}

											});
										},
										fail: () => {
											// console.log('微信登录授权失败1');
											uni.showToast({
												title: '服务出现异常'
											});
										}
									});

								},
								fail: err => {
									// console.log(err);

								}

							});
							//console.log(loginRes.authResult);
						},
						fail: ret => {
							// console.log(ret);
							// console.log('微信登录授权失败2');
							that.anleanniu = true;
							uni.showModal({
								content: '请登陆微信后再使用微信登陆',
								showCancel: false
							});

						},
						complete: () => {
							uni.hideLoading();
						}
					});
					// #endif



					var stystems = null;
					// #ifdef APP-PLUS
					// ifdef MP-WEIXIN
					uni.getSystemInfo({
						success: function(res) {
							if (res.platform == 'ios') {
								// console.log('苹果机器');
								stystems = 'iphone';
							} else {
								// console.log('不是苹果机器222');
								stystems = 'android';
							}
							// console.log(res.platform);
						}
					});

					uni.login({
						provider: 'weixin',
						success: res => {
							// console.log(JSON.stringify(res));
							// #ifdef APP-PLUS
							var devid = plus.device.uuid;
							var system_info = plus.device.model
							// #endif

							uni.getUserInfo({
								success: info => {
									// console.log(JSON.stringify(info));
									that.wxloginshow = false;

									var openid = info.userInfo.openId;
									// console.log("info.userInfo", info.userInfo);
									// 与服务器交互将数据提交到服务端数据库
									that.http({
										url: wxlogin_api,
										method: 'POST',
										header: {
											// 'content-type': 'application/x-www-form-urlencoded'
											'content-type': 'application/json'
										},
										data: {
											openid: openid,
											unionid: info.userInfo.unionId,
											nick_name: info.userInfo.nickName,
											pic_url: info.userInfo.avatarUrl,

											sex: info.userInfo.gender,
											gexing: null,
											devid: devid,

											system: stystems,

											system_info: system_info,
											version: '1.0.0',
											lastuptime: 0,
											lang: that.lang,

											apple_openid: null,
											apple_name: null,
											apple_famila: null,
											apple_email: null
											// console.log("Model: " + plus.device.model);
											// //获取设备的生产厂商
											// console.log("Vendor: " + plus.device.vendor);

											// unionid,
											// openid,
											// nick_name,	昵称
											// pic_url,
											// sex,		性别
											// gexing,		个性签名
											// devid,		硬件序列号
											// system,		设备类型:miniprog,android,iphone
											// system_info,	附加信息
											// version,	1.1.0	软件版本号
											// lastuptime,	上次题库更新时间戳
											// lang,		kz,ug,cn
											// apple_openid,
											// apple_name,
											// apple_famila,
											// apple_email
										},
										success: res => {
											// console.log(res);
											// console.log(JSON.stringify(res));
											that.usersetinfo(res, openid, info,
												true, info.userInfo.unionId);
											//存储openid

										},
										fail: err => {
											// console.log(err);
											that.anleanniu = false;
										}

									});
								},
								fail: () => {
									// console.log('微信登录授权失败1');
									that.anleanniu = false;
									uni.showToast({
										title: '服务器出现异常'
									});
								}
							});



						},
						fail: ret => {
							// console.log(ret);
							// console.log('微信登录授权失败2');
							that.anleanniu = true;
							uni.showModal({
								content: '请登陆微信后再使用微信登陆',
								showCancel: false
							});
						},
						complete: () => {
							uni.hideLoading();
						}
					});
					// #endif
				}
			},

			link: function(links) {
				var that = this;
				if (that.racheck === false) {
					uni.showModal({
						content: '请同意用户协议后操作',
						showCancel: false,
						success: function() {
							// console.log("pppppppppppppppppp")
							that.racheck = true
						}
					});
					return false;
				} else {
					if (links == 'ontrial') {
						that.activaModalshow = false
						that.ontrial = true
						that.experiencefalg = true
						uni.setStorageSync("ontrial", that.ontrial)
						that.checktys()
					} else if (links == 'buycode') {
						// console.log("一键激活一键激活")
						that.activaModalshow = false
						that.show = true
					} else {
						uni.navigateTo({
							url: '/pages' + links
						})
					}
				}

			},
			//控制协议是否被选
			setDoamin: function() {
				var that = this;
				this.racheck = !this.racheck;
				// console.log("chack ===" + that.racheck);
			},
			//立即激活
			onaction(num) {
				console.log("1-------")
				var that = this;
				var type = num;
				if (that.racheck === false) {
					uni.showModal({
						content: '请同意用户协议后操作',
						showCancel: false,
						success: function() {
							// console.log("pppppppppppppppppp")
							that.racheck = true
						}
					});
					return false;
				} else {
					console.log("2-------")
					uni.getStorage({
						key: 'user_infos',
						success: function(res) {
							var stystems = null;
							// #ifdef APP-PLUS
							uni.getSystemInfo({
								success: function(res) {
									if (res.platform == 'ios') {
										// console.log('苹果机器');
										stystems = 'iphone';
									} else {
										// console.log('不是苹果机器222');
										stystems = 'android';
									}
									// console.log(res.platform);
								}
							});
							// #endif

							// #ifdef MP-WEIXIN
							stystems = 'miniprog';
							// #endif
							// console.log(res);
							var uinfo = res.data;

							if (that.kahaonum == '') {
								uni.showModal({
									title: that.$t('jihuo.提示'),
									content: that.$t('jihuo.卡号不能为空'),
									success: function(res) {
										if (res.confirm) {
											// console.log('用户点击确定');
										} else if (res.cancel) {
											// console.log('用户点击取消');
										}
									}
								});
								return false;
							}
							if (that.kaminum == '') {
								uni.showModal({
									title: that.$t('jihuo.提示'),
									content: that.$t('jihuo.卡密不能为空'),
									success: function(res) {
										if (res.confirm) {
											// console.log('用户点击确定');
										} else if (res.cancel) {
											// console.log('用户点击取消');
										}
									}
								});
								return false;
							}

							that.https({
								url: jihuo_api,
								method: 'POST',
								data: {
									kahao: that.kahaonum,
									kami: that.kaminum,
									type: type
								},
								success: res => {
									console.log("3-------", res)
									// console.log("激活信息--------------------------------",res);
									//console.log(res.data.result_code);
									// console.log(res.result_code);

									//激活时:-1 用户没有登录，-2 用户已禁用，-3卡号或卡蜜错误，-4卡号没有销售，-5卡号已经激活不可重复使用，-6卡号被禁用，-7 其他错误,0 成功

									if (res.result_code == 0) {
										//成功
										uni.showModal({
											title: that.$t('jihuo.提示'),
											content: that.$t('jihuo.激活成功'),
											success: function(resg) {
												//先获取用户信息
												const value = uni.getStorageSync(
													'user_infos');
												var obj = JSON.parse(
													'{"openid":"' +
													value.openid +
													'","unionid": "' +
													value.unionid +
													'","kaishiriqi":"' +
													res.kaishiriqi +
													'","jieshuriqi":"' +
													res.jieshuriqi +
													'","userstatus":"' +
													res.userstatus +
													'","jihuofangshi":"' +
													value.jihuofangshi +
													'","nick_name":"' +
													value.nick_name +
													'","pic_url":"' +
													value.pic_url +
													'","uid":"' +
													value.uid +
													'","dailijibie":"' +
													res.dailijibie +
													'"}'
												);

												try {
													uni.setStorageSync('user_infos',
														obj);
													// uni.reLaunch({
													// 	url: "../index/start"
													// })
													that.activaModalshow = false
												} catch (e) {
													// error
												}

												// uni.setStorage({
												//     key: 'user_infos',
												//     data: obj,
												//     success: function () {
												//         console.log('success');

												//     }
												// });
												//uni.setStorageSync('user_infos', obj);
											}
										});
									}


									if (res.result_code == -1) {
										this.activaModalshow = true
										//用户没有登录,让他微信登录
										uni.showModal({
											title: that.$t('jihuo.提示'),
											content: that.$t('jihuo.用户没有登录'),
											success: function(resw) {
												if (res.confirm) {
													// console.log('用户点击确定');
												} else if (res.cancel) {
													// console.log('用户点击取消');
												}
											}
										});
										return false;
									}
									if (res.result_code == -2) {
										this.activaModalshow = true
										//用户已禁用
										uni.showModal({
											title: that.$t('jihuo.提示'),
											content: that.$t('jihuo.用户已禁用'),
											success: function(resw) {
												if (res.confirm) {
													// console.log('用户点击确定');
												} else if (res.cancel) {
													// console.log('用户点击取消');
												}
											}
										});
										return false;
									}
									if (res.result_code == -3) {
										this.activaModalshow = true
										//卡号或卡密错误
										uni.showModal({
											title: that.$t('jihuo.提示'),
											content: that.$t('jihuo.卡号或卡密错误'),
											success: function(resw) {
												if (res.confirm) {
													// console.log('用户点击确定');
												} else if (res.cancel) {
													// console.log('用户点击取消');
												}
											}
										});
										return false;
									}
									if (res.result_code == -4) {
										this.activaModalshow = true
										//-4卡号没有销售
										uni.showModal({
											title: that.$t('jihuo.提示'),
											content: that.$t('jihuo.卡号没有销售'),
											success: function(resw) {
												if (res.confirm) {
													// console.log('用户点击确定');
												} else if (res.cancel) {
													// console.log('用户点击取消');
												}
											}
										});
										return false;
									}
									if (res.result_code == -5) {
										this.activaModalshow = true
										//-5卡号已经激活不可重复使用
										uni.showModal({
											title: that.$t('jihuo.提示'),
											content: that.$t('jihuo.卡号已经激活不可重复使用'),
											success: function(resw) {
												if (res.confirm) {
													// console.log('用户点击确定');
												} else if (res.cancel) {
													// console.log('用户点击取消');
												}
											}
										});
										return false;
									}
									if (res.result_code == -6) {
										this.activaModalshow = true
										//-6卡号被禁用
										uni.showModal({
											title: that.$t('jihuo.提示'),
											content: that.$t('jihuo.卡号被禁用'),
											success: function(resw) {
												if (res.confirm) {
													// console.log('用户点击确定');
												} else if (res.cancel) {
													// console.log('用户点击取消');
												}
											}
										});
										return false;
									}
									if (res.result_code == -7) {
										this.activaModalshow = true
										//-7 其他错误
										uni.showModal({
											title: that.$t('jihuo.提示'),
											content: that.$t('jihuo.其他错误'),
											success: function(resw) {
												if (res.confirm) {
													// console.log('用户点击确定');
												} else if (res.cancel) {
													// console.log('用户点击取消');
												}
											}
										});
										return false;
									}
									if (res.result_code == -8) {
										this.activaModalshow = true
										uni.showModal({
											title: that.$t('jihuo.提示'),
											content: that.$t('jihuo.其他错误'),
											success: function(resw) {
												if (res.confirm) {
													// console.log('用户点击确定');
												} else if (res.cancel) {
													// console.log('用户点击取消');
												}
											}
										});
										return false;
									}

									// {
									// 	"result_msg": "",
									// 	"jieshuriqi": "0",
									// 	"jiehuofangshi": "0",
									// 	"userstatus": "0",
									// 	"dailijibie": "0",
									// 	"result_code": "-1",
									// 	"kaishiriqi": "0"
									// }
									//this.addresslist = res;
								},
								fail: err => {
									// console.log(err);
									uni.showModal({
										title: '错误',
										content: "服务器出现错误：" + err,
										success: function(resw) {
											if (res.confirm) {
												// console.log('用户点击确定');
											} else if (res.cancel) {
												// console.log('用户点击取消');
											}
										}
									});
								},
								complete: function(eeee) {
									//console.log(eeee,'com')
								}
							});

							// console.log(that.kaminum, that.kahaonum);
						},
						fail() {
							//返回登录按钮，重新微信登录
							uni.hideLoading();
						}
					});
				}
			},
			onkami(val) {
				// console.log("卡号",val)
				this.kaminum = val.target.value
			},
			onkahao(val) {
				this.kahaonum = val.target.value
			},
			handlelangSelect() {
				this.langtypeFLag = !this.langtypeFLag
			},
			handlecartSelect() {
				this.carttypeFlag = !this.carttypeFlag
			},
			handleyearSelect() {
				this.yeartypeFlag = !this.yeartypeFlag
			},
			// 语言切换
			langSelect(item, index) {
				this.langIndex = index
				this.langtypeFLag = false
				// console.log("语言", this.langList[this.langIndex])
				if (index == 0) {
					this.$i18n.locale = 'cn';
					this.lang = 'cn';
					this.lolang = 'CN';
				}

				if (index == 1) {
					this.$i18n.locale = 'kz';
					this.lang = 'kz';
					this.lolang = 'KAZ';
				}
				if (index == 2) {
					this.$i18n.locale = 'uy';
					this.lang = 'uy';
					this.lolang = 'UG';
				}


				var kemu = uni.getStorageSync("kemu_type", )
				this.minitikucount(this.zzjz, 0)

				// 注释3
				// //#ifdef APP-PLUS
				// this.dbcount()
				// //#endif


				setTimeout(() => {
					this.tabbarlist = [{
							text: this.$t('indexs.首页'),
							iconPath: "https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/icon1.png",
							selectedIconPath: "https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/icon1ed.png",
							customIcon: false,
						},
						{
							text: this.$t('indexs.我的'),
							iconPath: "https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/icon2.png",
							selectedIconPath: "https://tongyongjiakao-1307163845.cos.ap-shanghai.myqcloud.com/used_img/icon2ed.png",
							customIcon: false,
						}
					]

					this.zgzList = [this.$t('indexs.货运'), this.$t('indexs.客运'), this.$t('indexs.危险品')]
					// console.log(this.list);
				}, 20)
				uni.setStorageSync("lang_key", this.lang)



			},
			//车型切换
			classSelect(item, index) {
				// console.log(item, 'item456');
				// console.log(index, '14893');
				this.classIndex = index
				this.subject = this.zgzList[this.classIndex]
				this.carttypeFlag = false
				let cartName = ''
				// console.log("车型", this.zgzList[this.classIndex])
				// if (this.zgzList[this.classIndex] == "货运") {
				// 	this.subject = getCarType("货运");
				// 	cartName = '货运'
				// }
				// if (this.zgzList[this.classIndex] == "客运") {
				// 	this.subject = getCarType("客运");
				// 	cartName = '客运'
				// }
				// if (this.zgzList[this.classIndex] == "危险品") {
				// 	this.subject = getCarType("危险品");
				// 	cartName = '危险品'
				// }

				if (this.classIndex == 0) {
					this.subject = getCarType("货运");
					// console.log(this.subject,'22222222222');
					cartName = '货运'
				}
				if (this.classIndex == 1) {
					this.subject = getCarType("客运");
					// console.log(this.subject,'222222222223333333');
					cartName = '客运'
				}
				if (this.classIndex == 2) {
					this.subject = getCarType("危险品");
					// console.log(this.subject,'222222222228888888');
					cartName = '危险品'
				}

				var kemu = uni.getStorageSync("kemu_type", )
				this.minitikucount(this.zzjz, 0)

				// 注释4
				// //#ifdef APP-PLUS
				// this.dbcount()
				// //#endif
				uni.setStorageSync("cart_type", cartName)
			},

			//年份切换
			yearSelect(item, index) {
				this.yearIndex = index
				this.yeartypeFlag = false
				// console.log("e.detail.value", index)
				if (index == 0) {
					this.year = "2022"
				} else {
					this.year = "2023"
				}


				var kemu = uni.getStorageSync("kemu_type", )
				// console.log("kemu===============kemu", kemu)
				this.minitikucount(this.zzjz, 0)


				// 注释5
				// //#ifdef APP-PLUS
				// this.dbcount()
				// //#endif

				uni.setStorageSync("year_key", this.year)

			},
			userstat: function() {
				var that = this;
				uni.getStorage({
					key: 'user_infos',
					success: function(res) {

						var uinfo = res.data;

						var stystems = null;
						// #ifdef APP-PLUS
						uni.getSystemInfo({
							success: function(res) {
								if (res.platform == 'ios') {
									//console.log('苹果机器');
									stystems = 'iphone';
								} else {
									//console.log('不是苹果机器222');
									stystems = 'android';
								}
								//console.log(res.platform);
							}
						});
						// #endif

						// #ifdef MP-WEIXIN
						stystems = 'miniprog';
						// #endif

						// #ifdef MP-WEIXIN
						var devid = '100010010';
						var system_info = 'miniprogram'
						// #endif
						// #ifdef APP-PLUS
						var devid = plus.device.uuid;
						var system_info = plus.device.model
						// #endif
						var versionsss = '1.0.0';
						that.http({
							url: wxlogin_api,
							method: 'POST',
							header: {
								// 'content-type': 'application/x-www-form-urlencoded'
								'content-type': 'application/json'
							},
							data: {
								openid: uinfo.openid,
								unionid: uinfo.unionid,
								nick_name: uinfo.nick_name,
								pic_url: uinfo.pic_url,
								sex: uinfo.gender,
								gexing: null,
								devid: devid,
								system: stystems,
								system_info: system_info,
								version: versionsss,
								lastuptime: 0,
								lang: that.lang,
								apple_openid: null,
								apple_name: null,
								apple_famila: null,
								apple_email: null
							},
							success: resu => {
								//console.log(resu);
								//console.log(JSON.stringify(resu));

								//存储openid
								that.usersetinfo(resu, uinfo.openid, uinfo);


								//that.wxloginshow = false;
								//判断是否激活过 如果激活过，跳转到首页，如果没没有激活，继续激活
								// userstatus -- -3其他情况 -2到期 -1禁用 0-不是会员 1-普通会员 2-高级会员 3代理
								//var userstatus = res.userstatus;
								//var userstatus = -2;




							},
							fail: err => {
								//console.log(err);
							}

						});
					},
					fail() {
						//返回登录按钮，重新微信登录
						uni.hideLoading();
					}
				});
			},
			usersetinfo: function(res, openid, info) {
				// console.log("资格证用户信息", info)
				var that = this;
				uni.setStorageSync('openid', openid);

				var obj = JSON.parse(
					'{"openid":"' +
					openid +
					'","unionid": "' +
					info.unionid +
					'","kaishiriqi":"' +
					res.kaishiriqi +
					'","jieshuriqi":"' +
					res.jieshuriqi +
					'","userstatus":"' +
					res.userstatus +
					'","jihuofangshi":"' +
					res.jihuofangshi +
					'","nick_name":"' +
					info.userInfo.nickName +
					'","pic_url":"' +
					info.userInfo.avatarUrl +
					'","uid":"' +
					res.uid +
					'","dailijibie":"' +
					res.dailijibie +
					'"}'
				);

				uni.setStorageSync('user_infos', obj);
				that.handleUserStatus(res.userstatus, res.jieshuriqi)
			},
			handleUserStatus(userstatus, jieshuriqi) {
				// console.log("simeng5555555555555", userstatus)
				var that = this
				//判断是否激活过 如果激活过，跳转到首页，如果没没有激活，继续激活
				// userstatus -- -3其他情况 -2到期 -1禁用 0-不是会员 1-普通会员 2-高级会员 3代理			
				if (userstatus == -3) {
					//禁用状态
					this.activaModalshow = false
					// uni.showModal({
					// 	title: that.$t('jihuo.提示'),
					// 	content: that.$t(
					// 		'jihuo.您的账号已出现问题'),
					// 	success: function(res) {
					// 		if (res.confirm) {
					// 			console.log(
					// 				'用户点击确定'
					// 			);
					// 		} else if (res
					// 			.cancel) {
					// 			console.log(
					// 				'用户点击取消'
					// 			);
					// 		}
					// 	}
					// });
					return false;
				}

				if (userstatus == -2) {

					//禁用状态
					this.activaModalshow = false
					// console.log("simeng3333333333333")
					// uni.showModal({
					// 	title: that.$t('jihuo.提示'),
					// 	content: that.$t(
					// 		'jihuo.您的账号已到期'),
					// 	success: function(res) {
					// 		if (res.confirm) {
					// 			console.log(
					// 				'用户点击确定'
					// 			);
					// 		} else if (res
					// 			.cancel) {
					// 			console.log(
					// 				'用户点击取消'
					// 			);
					// 		}
					// 	}
					// });
					return false;
				}
				if (userstatus == -1) {
					//禁用状态
					this.activaModalshow = false
					// uni.showModal({
					// 	title: that.$t('jihuo.提示'),
					// 	content: that.$t(
					// 		'jihuo.您的账号已禁用'),
					// 	success: function(res) {
					// 		if (res.confirm) {
					// 			console.log(
					// 				'用户点击确定'
					// 			);
					// 		} else if (res
					// 			.cancel) {
					// 			console.log(
					// 				'用户点击取消'
					// 			);
					// 		}
					// 	}
					// });
					return false;
				}
				if (userstatus == 0) {
					//普通用户
					this.activaModalshow = true
				}

				if (userstatus > 0) {
					//判断时间是否到？
					let timestamp = new Date().getTime();
					if (jieshuriqi < timestamp) {
						//时间到期
						if (that.isConnected == false) {
							uni.showModal({
								title: that.$t('jihuo.提示'),
								content: that.$t('jihuo.请联网后重新激活'),
								success: function(res) {
									if (res.confirm) {
										// console.log('用户点击确定');
									} else if (res.cancel) {
										// console.log('用户点击取消');
									}
								}
							});
						} else {
							// console.log("simeng4444444444444444")
							uni.showModal({
								title: that.$t('jihuo.提示'),
								content: that.$t('jihuo.您的账号已到期'),
								success: function(res) {
									if (res.confirm) {
										// console.log('用户点击确定');
									} else if (
										res.cancel
									) {
										// console.log('用户点击取消');
									}
								}
							});
						}
					} else {
						//激活弹框隐藏
						this.activaModalshow = false
						this.minitikucount(1, this.kemu)

					}
				}
			},
			changetime(timestamp) {
				//console.log("timestamp",timestamp);
				var that = this;
				////console.log(timestamp);
				var userval = uni.getStorageSync('user_infos');
				if (Number(userval.userstatus) > 0) {
					that.tiyanshow = false;
					return false;
				}
				if (timestamp < 0) {
					getApp().globalData.tiyan = 1;
					return false;
				}
				uni.setStorageSync('tiyan_times', timestamp);
				that.tiyan_time = timestamp;
				that.timestarts = true;
			},
			tiyanstart: function() {
				var that = this;
				var tiendtime = uni.getStorageSync('tiyan_times');
				// console.log("tiendtime*********************************", tiendtime)
				if (tiendtime) {

				} else {
					//没有任何记录
					uni.setStorageSync('tiyan_times', that.tiyan_time);
				}

			},
			tiyanend: function() {

				var that = this;

				var pages = getCurrentPages() // 获取栈实例
				let currentRoute = pages[pages.length - 1].route; // 获取当前页面路由


				try {
					const value = uni.getStorageSync('ontrial_time');
					if (value) {
						that.tiyanshow = false;

						return false;
					}
				} catch (e) {
					// error
				}


				//console.log('tiyan end');
				if (that.tanchukuang == false) {
					that.tanchukuang = true;
					uni.showModal({
						title: '提示',
						content: '体验已结束！',
						success: function(res) {
							that.tiyanshow = false;
							const valuej = uni.getStorageSync('jshenhe');
							if (valuej) {
								that.linkaction();
							} else {
								// console.log("show4444444444444")
								that.show = true;
							}
							that.tanchukuang = false;
							try {
								uni.setStorageSync('ontrial_time', 'hello');
								//体验过
								getApp().globalData.tiyan = 1;
							} catch (e) {
								// error
							}
							if (res.confirm) {
								//console.log('用户点击确定');

								if (currentRoute != 'pages/index/qualification') {
									uni.reLaunch({
										url: '/pages/index/qualification?alert=1'
									})

								}
							} else if (res.cancel) {

								if (currentRoute != 'pages/index/qualification') {
									uni.reLaunch({
										url: '/pages/index/qualification?alert=1'
									})

								}
							}
						}
					});
				}

			},
			tiyan: function() {
				var that = this;
				//console.log("tiyan kai shi");
				var ontrials = uni.getStorageSync('tiyan_times'); //tiyan_times
				if (getApp().globalData.tiyan == 1) {
					//已经体验过
					if (ontrials === 0) {
						const valuej = uni.getStorageSync('jshenhe');
						if (valuej) {
							that.linkaction();
						} else {
							// console.log("show5555555555555")
							that.show = true;
							// that.linkaction();
						}
					} else {
						that.tiyanshow = true;
					}

				} else {
					//没有体验过
					that.tiyanshow = true;
					that.tiyanstart();
					getApp().globalData.tiyan = 2;
				}


			},
			linkaction() {
				// console.log('我执行了');
				this.activaModalshow = true

			},
			checkty: function() {
				//检查体验
				var that = this;
				//先检查 会员是否登录
				const value = uni.getStorageSync('user_infos');
				if (value) {
					//会员登录过
					//console.log(value);
					//console.log(value.userstatus);
					var usernum = Number(value.userstatus);
					//console.log("usernum=", usernum);
					if (usernum < 1) {
						//没有开通过会员
						//检查是否体验过？
						uni.getStorage({
							key: 'ontrial_time',
							success: function(res) {
								//已经体验过了  不要胡闹
								that.show = true;
								return false;
								//console.log("ottyan")
							},
							fail() {
								//没有体验过，先让他体验
								//console.log("ttyan")
								if (that.tiyanshow) {
									return true;
								} else {
									that.tiyan();
								}

							}
						});
					}
				} else {
					//会员没有登录过
					uni.reLaunch({
						url: '../activation/activeModal/activeModal'
					})
				}



			},
			checktys: function() {

				// console.log("判断是否可以使用120秒")
				//检查体验
				var that = this;
				var tstatic = false;
				//先检查 会员是否登录

				const value = uni.getStorageSync('user_infos');
				if (value) {
					//会员登录过
					//console.log(value);
					// value.userstatus = 0
					if (value.userstatus < 1) {
						//没有开通过会员
						//检查是否体验过？
						var ontrials = uni.getStorageSync('tiyan_times'); //tiyan_times
						// console.log("ontrials", ontrials)
						// ontrials=0
						if (ontrials === 0) {
							const valuej = uni.getStorageSync('jshenhe');
							// console.log("jshenhe", valuej)
							if (valuej) {
								that.linkaction();
							} else {
								// console.log("show6666666666666")
								that.show = false;
								// that.linkaction();
							}
							tstatic = false;
						} else {

							that.tiyanshow = true
							tstatic = true;
						}

					} else {
						// console.log("要试用120秒")
						tstatic = true;
					}
				} else {
					//如果没有用户信息


				}
				return tstatic;

			},
			adlists() {
				var that = this;

				var date = new Date();
				var hour = date.getHours();
				uni.getStorage({
					key: 'banner_' + hour,
					success: function(res) {
						// console.log("不进入加载banner")
						that.bannerlist = res.data;
					},
					fail: function() {
						// console.log("进入加载banner")
						that.https({
							url: guanggao_api,
							method: 'POST',
							header: {
								'content-type': 'application/json'
							},
							data: {
								type: 0
							},
							loaddings: false,
							success: res => {
								// console.log(res);
								//app缓存到本地
								//小程序读取在线
								var imgjson = [];
								var imgurl = res.images;
								for (var i = 0; i < 4; i++) {
									var imgstr = {
										image: imgurl[i],
										title: 'tongyongjiakao'
									}
									imgjson.push(imgstr);
								}
								// console.log("imgjson", imgjson);
								uni.setStorage({
									key: 'banner_' + hour,
									data: imgjson,
									success: function() {
										// console.log('success');
										that.bannerlist = imgjson;
									}
								});

							},
							fail: err => {
								//console.log(err);
								uni.showModal({
									title: '错误提示',
									content: err,
									success: function(res) {
										if (res.confirm) {
											//console.log('用户点击确定');
										} else if (res.cancel) {
											//console.log('用户点击取消');
										}
									}
								});
							}
						});
					}
				})

			},
			wrongslink() {
				var that = this;
				// console.log('link to wrongs');
				let userinfo = uni.getStorageSync('user_infos')
				if (userinfo.userstatus < 0) {
					// console.log("rrrrrrrrrr", uni.getStorageSync("ontrial"));
					if (uni.getStorageSync("ontrial")) {
						that.activaModalshow = false
					} else {
						that.activaModalshow = true
						return
					}
				}

				if (that.workskemu > 0) {
					uni.navigateTo({
						url: '../practice/wrongs?kemu=0'
					});
				} else {
					uni.showModal({
						title: '提示',
						cancel: false,
						content: '没有错题收',
						success: function(res) {}
					});
				}
				// uni.navigateTo({
				// 	url:'../practice/wrongs?kemu=0',
				// 	success(e){
				// 		console.log("cheng gong")
				// 	},
				// 	fail(s) {
				// 		console.log("err",s);
				// 	},
				// 	complete(t) {
				// 		console.log(t)
				// 	}

				// })

				// console.log('link to test *********************');
			},

			minitikucount(zzlx, kemu) {
				var that = this;
				// if (that.lolang == 'CN') {
				// 	that.year = "2023"
				// }
				// console.log("kemu-------=", kemu)

				that.https({
					url: tikucounts_api,
					method: 'POST',
					header: {
						'content-type': 'application/json'
					},
					data: {
						lang: that.lolang,
						zzlx: zzlx,
						kemu: kemu, //资格证是 科目是0
						ktype: that.subject,
						year: that.lolang == 'CN' ? '2023' : that.year
					},
					success: res => {
						//console.log(res);

						that.allcount = res.danxuan_count + res.duicuo_count + res.duoxuan_count;
						// console.log(that.allcount, '////////////////////////////////8888888888888888');
						var alcount = res.danxuan_count + res.duicuo_count + res.duoxuan_count;
						uni.setStorage({
							key: that.subject + '_count_' + that.kemu,
							data: alcount,
							success: function() {
								//console.log('顺序练习总数');
							}
						});

					},
					fail: err => {
						//console.log(err);
					}
				});


				//显示已答题数量

				uni.getStorage({
					key: that.subject + '_dati_' + that.lang + "_" + that.kemu,
					success: function(res) {
						// console.log("hate+twra", res);
						var twra = 0;
						var hate = 0;
						var tipanduan = res.data;
						//计算 错题对题数量
						for (var i = 0; i < tipanduan.length; i++) {
							if (tipanduan[i].useranswer !== null && tipanduan[i].useranswer !==
								undefined) {
								if (tipanduan[i].twrahate == 1) {
									twra++;
								}
								if (tipanduan[i].twrahate == 0) {
									hate++;
								}
							}
						}
						// console.log("hate+twra", hate + twra)

						that.compentcount = hate + twra;

					},
					fail(e) {
						//console.log('index key no', e);
						//没有任何记录
						that.compentcount = 0

					}
				});
				//显示模拟题成绩
				uni.getStorage({
					key: that.subject + '_examlist_' + that.lang + "_" + that.kemu,
					success: function(res) {
						//console.log(res.data);
						var exlistnum = res.data[0].recordnum;
						that.examkemu = exlistnum;
					},
					fail(e) {
						//console.log('index key no', e);
						//没有任何记录
						that.examkemu = 0
					}
				});
				//获取错题收藏值

				that.https({
					url: cuotilist_api,
					method: 'POST',
					header: {
						'content-type': 'application/json'
					},
					data: {
						tlang: that.lolang,
						ktype: that.subject,
						zhengjianlx: zzlx, //资格证是 科目是0
						kemu: kemu,
						ttype: -1
					},
					success: res => {
						that.workskemu = res.list.length;
					},
					fail: err => {
						//console.log(err);
						uni.showModal({
							title: '服务错误提示',
							content: err,
							success: function(res) {
								if (res.confirm) {
									//console.log('用户点击确定');
								} else if (res.cancel) {
									//console.log('用户点击取消');
								}
							}
						});
					}
				});


			},


			publicmoreUrl(e) {
				// console.log('zhu fang fa');
				uni.removeStorage({
					key: 'kemu_type',
					success: function(res) {
						uni.navigateTo({
							url: '../setting/setting'
						});
					}
				});
			},
			//打开数据库
			openDb() {
				var that = this;
				if (isOpen('data')) return;
				openDb('data').then(res => {
					// console.log(res);
					// uni.getStorage({
					// 	key: 'kemu_type',
					// 	success: function(res) {
					that.dbcount(that.kemu);
					//that.dbid(that.kemu);
					// 		console.log('kemu', res.data);
					// 	}
					// });
				});
			},
			dbcount() {
				// console.log(789123);
				var that = this;
				// if (that.lolang == 'CN') {
				// 	that.year = "2023"
				// }
				var yeared = that.lolang == 'CN' ? '2023' : that.year
				//查询总数
				plus.sqlite.selectSql({
					name: 'data',
					sql: 'select count(*) as num from Tiku where kemu=' + that.kemu + " and ktype='" +
						that.subject + "' and tlang = '" + that.lolang + "' and year = '" + yeared + "'",
					success(e) {
						// console.log(e);
						// console.log('select count(*) as num from Tiku where kemu=' + that.kemu + " and ktype='" +
						// 	that.subject + "' and tlang = '" + that.lolang + "' and year = '" + yeared + "'"
						// );
						that.allcount = e[0].num;
					},
					fail(e) {
						// console.log(e);
					}
				});
				//查询已完成的
				plus.sqlite.selectSql({
					name: 'data',
					sql: 'select count(*) as num from Tiku where useranswer not null and kemu=' + that.kemu +
						" and ktype='" + that.subject + "' and tlang = '" + that.lolang + "' and year = '" +
						yeared + "'",
					success(e) {
						// console.log(e, 'ahahah/////////////////////////');
						// console.log(
						// 	'select count(*) as num from Tiku where  useranswer not null and kemu=' + that
						// 	.kemu + " and ktype='" + that.subject + "' and tlang = '" + that.lolang +
						// 	"' and year = '" + yeared + "'", '25896314789'
						// );
						that.compentcount = e[0].num;
					},
					fail(e) {
						// console.log(e);
					}
				});
				//查询模拟考试成绩
				plus.sqlite.selectSql({
					name: 'data',
					sql: "select recordnum from record where subject='" + that.subject + "' and tlang = '" + that
						.lolang + "' and kemu =0  order by id desc",
					success(e) {
						// console.log('查询模拟考试成绩:', e);

						that.examkemu = e[0].recordnum;
					},
					fail(e) {
						// console.log(e);
					}
				});
				//查询错题收藏
				plus.sqlite.selectSql({
					name: 'data',
					sql: "select count(*) as num from Tiku where useranswer not null and kemu=0 and complete=1 or collect=1 and ktype='" +
						that.subject +
						"' and tlang = '" +
						that.lolang + "' and year = '" + yeared + "'",
					success(e) {
						// console.log(e[0].num);
						that.workskemu = e[0].num;
					},
					fail(e) {
						//console.log(e);
					}
				});
				// plus.sqlite.selectSql({
				// 	name: 'data',
				// 	sql:
				// 		"select recordnum from record where subject='" + that.subject + "' and tlang = '" + that.lolang + "' and kemu = 0  order by id desc",
				// 	success(e) {
				// 		console.log('查询模拟考试成绩:', e);

				// 		that.workskemu = e[0].recordnum;
				// 	},
				// 	fail(e) {
				// 		console.log(e);
				// 		console.log("select recordnum from record where subject='" + that.subject + "' and tlang = '" + that.lolang + "' and kemu = 0   order by id desc")
				// 	}
				// });
			},

			radioChange: function(evt) {
				var that = this;
				that.payortype = true;
				that.checkpay();
				// for (let i = 0; i < this.items.length; i++) {
				//     if (this.items[i].value === evt.detail.value) {
				//         this.current = i;
				//         break;
				//     }
				// }
			},
			cartclick(num) {
				var that = this;
				if (num == 0) {
					that.seasoncart = true;
					that.vipcart = false;
				}
				if (num == 1) {
					that.vipcart = true;
					that.seasoncart = false;
				}
				that.checkpay();
			},
			checkpay() {
				var that = this;
				if (that.seasoncart == true || that.vipcart == true) {
					if (that.payortype == true) {
						that.buttontext = this.$t('indexs.支付');
					} else {
						that.buttontext = this.$t('indexs.选择支付方式');
					}
				} else {
					that.buttontext = this.$t('indexs.选择卡类型');
				}
			},
			reachBottom() {
				// 此tab为空数据
				if (this.current != 2) {
					this.loadStatus.splice(this.current, 1, 'loading');
					setTimeout(() => {
						this.getOrderList(this.current);
					}, 1200);
				}
			},
			mlink: function(linsk) {
				var that = this;

				if (linsk == 'about') {
					uni.navigateTo({
						url: '../ucenter/about'
					});
					return
				}
				let userinfo = uni.getStorageSync('user_infos')

				if (userinfo.userstatus < 1) {
					// console.log("rrrrrrrrrr", uni.getStorageSync("ontrial"));
					if (uni.getStorageSync("ontrial")) {
						that.activaModalshow = false
						// console.log("yyyyyyyy")
					} else {
						that.activaModalshow = true
						return
					}
				}
				var tycc = that.checktys();
				// console.log("tycc=", tycc);
				//return false;
				//console.log(that.kumu, km);


				if (tycc) {


					if (linsk == 'relevant') {
						uni.navigateTo({
							url: '../media/relevant'
						});
					}
					if (linsk == 'roadaudio') {
						uni.navigateTo({
							url: '../media/roadaudio'
						});
					}
					if (linsk == 'medialist') {
						uni.navigateTo({
							url: '../media/medialist'
						});
					}
					if (linsk == 'exam') {
						//修改完成 测试完成
						uni.navigateTo({
							url: '../practice/mocks?kemu=0&zzlx=1'
						});
					}
					if (linsk == 'recite') {
						uni.navigateTo({
							url: '../practice/recite?kemu=0&kemusane=' + that.allcount + '&zzlx=1'
						});
					}
					if (linsk == 'examrecord') {
						uni.navigateTo({
							url: '../practice/examresults?kemu=0'
						});
					}
					if (linsk == 'guidepost') {
						uni.navigateTo({
							url: '../guidepost/guidepost'
						})
					}
					// console.log(linsk);
					if (linsk == 'practice') {
						uni.navigateTo({
							url: '../practice/practice?kemu=0&kemusane=' + that.allcount + '&zzlx=1'
						});
					}
					if (linsk == 'winnow') {
						let num = null
						//精选判断
						that.https({
							url: jingxuan_api,
							method: "POST",
							header: {
								"content-type": "application/json",
							},
							data: {
								lang: that.lolang,
								zzlx: that.zzlx,
								kemu: that.kemu, //资格证是 科目是0
								ktype: that.subject,
								index: 0,
								year: this.year,
								jingxuan: '1',
							},
							success: (res) => {
								uni.hideLoading();
								// console.log("首页精选数量----------", res)
								num = res.count
								if (num != 0) {

									uni.navigateTo({
										url: '../practice/winnow?kemu=0&kemusane=' + res.count +
											'&zzlx=1'
									});
								} else {
									uni.showModal({
										title: '提示',
										cancel: false,
										content: '此车类型没有精选500',
										success: function(res) {}
									});
								}
							},
							fail: (err) => {
								uni.hideLoading();
								// console.log(err);
								uni.showModal({
									title: "错误提示",
									content: err,
									success: function(res) {
										if (res.confirm) {
											// console.log("用户点击确定");
										} else if (res.cancel) {
											// console.log("用户点击取消");
										}
									},
								});
							},
						})


					}
				} else {
					// that.show = true;
					const valuej = uni.getStorageSync('jshenhe');
					if (valuej) {
						that.linkaction();
					} else {
						// console.log("show8888888888888")
						that.linkaction();
					}
				}
			},
			// tabs通知swiper切换
			tabsChange(index) {
				this.swiperCurrent = index;
			},
			// swiper-item左右移动，通知tabs的滑块跟随移动
			transition(e) {
				let dx = e.detail.dx;
				this.$refs.uTabs.setDx(dx);
			},
			// 由于swiper的内部机制问题，快速切换swiper不会触发dx的连续变化，需要在结束时重置状态
			// swiper滑动结束，分别设置tabs和swiper的状态
			animationfinish(e) {
				let current = e.detail.current;
				this.$refs.uTabs.setFinishCurrent(current);
				this.swiperCurrent = current;
				this.current = current;
			},
			// scroll-view到底部加载更多
			onreachBottom() {},
			change(index) {
				// console.log(index);
			},
			beforeSwitch(index) {
				// console.log("index-index======", index);
				if (index == 1) {
					uni.navigateTo({
						url: '/pages/ucenter/ucenter?page=qualification'
					})
					// this.$u.route({
					// 	url: '/pages/ucenter/ucenter'
					// 	// params: {
					// 	// 	name: 'lisa'
					// 	// }
					// });
				}
			}
		}
	};
</script>

<style scoped lang="scss">
	.pop1 {
		::v-deep.u-mode-center-box {
			background: transparent !important;
		}
	}

	.heigt-over {
		height: 978rpx;
	}

	.content {
		width: 590rpx;
		height: 910rpx;
		// position: fixed;
		// top: 216rpx;
		// left: 80rpx;

		.content-imgbg {
			// width: 100%;
			// height: 100%;
			width: 590rpx;
			height: 910rpx;
			position: absolute;
			top: 0;
			left: 0;
		}

		.content-box {
			position: absolute;
			width: 590rpx;
			top: 93rpx;
			left: 13.5rpx;
			padding-left: 22rpx;
			padding-top: 65rpx;
			padding-bottom: 30rpx;
			box-sizing: border-box;
			width: 565rpx;
			// height: 795rpx;
			border-radius: 20rpx;
			border: 1rpx solid #E4BC8B;

			.title {
				font-size: 40rpx;
				font-family: PingFangSC-Medium, PingFang SC;
				font-weight: 500;
				color: #4C361B;
				line-height: 56rpx;
				margin-left: 138rpx;
			}

			.usernum {
				width: 516rpx;
				height: 79rpx;
				background: #FAE8D3;
				border-radius: 20rpx;
				line-height: 79rpx;
				padding-left: 34rpx;
				box-sizing: border-box;
				font-size: 30rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #744507;
				display: flex;
				margin-top: 36rpx;

				.lable {
					display: flex;
					align-items: center;
				}

				.usernum-input {
					margin-top: 15rpx;
				}
			}

			.active {
				width: 516rpx;
				height: 79rpx;
				border-radius: 50rpx;
				background: #E4BC8B;
				text-align: center;
				line-height: 79rpx;
				color: rgba(132, 95, 36, 1);
				font-size: 32rpx;
				font-family: PingFangSC-Medium;
				font-weight: 500;
				margin-top: 36rpx;
			}

			.tiaoli {
				margin-left: 84rpx;
				margin-top: 14rpx;
				font-size: 22rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #D9CBB3;
				line-height: 30rpx;
				// text-align: center;

			}

			.box_1 {
				width: 518rpx;
				margin-top: 20rpx;
				display: flex;

				.image_2 {
					width: 182rpx;
					height: 1rpx;
					margin: 15rpx 0 14rpx 0;
					background: #E4BC8B;
				}

				.text_5 {
					overflow-wrap: break-word;
					color: rgba(225, 191, 144, 1);
					font-size: 22rpx;
					font-weight: NaN;
					text-align: left;
					white-space: nowrap;
					line-height: 30rpx;
					margin: 0 20rpx;
				}

				.image_3 {
					width: 182rpx;
					height: 1rpx;
					margin: 15rpx 0 14rpx 0;
					background: #E4BC8B;
				}
			}

			.shiyong-jihuo {
				width: 517rpx;
				display: flex;
				justify-content: space-between;
				margin-top: 30rpx;

				.btn {
					border-radius: 8px;
					padding: 15rpx 55rpx 14rpx 55rpx;
					font-size: 28rpx;
					text-align: left;
					line-height: 40rpx;
				}

				.shiyong {
					background-color: #434343;
					color: #ffffff;
				}

				.jihuo {
					background-color: rgba(194, 56, 56, 1);
					color: rgba(255, 255, 255, 1);
				}
			}

			.tuixiaoyuan {
				background-color: rgba(13, 160, 255, 1);
				border-radius: 8px;
				margin-top: 20rpx;
				width: 516rpx;
				height: 69rpx;
				// padding: 12rpx 182rpx 13rpx 182rpx;
				color: rgba(255, 255, 255, 1);
				font-size: 30rpx;
				text-align: center;
				line-height: 69rpx;
			}

		}


	}

	.daojishibox {
		width: 750rpx;
		height: 83rpx;
		background: #FFE8BC;
		border-radius: 0rpx 0rpx 0rpx 0rpx;
		opacity: 1;
		margin-top: 15rpx;
		display: flex;
		padding-left: 270rpx;
		box-sizing: border-box;

		.daojitxt {
			margin-top: 20rpx;
			font-family: PingFang SC-Bold, PingFang SC;
		}

		.daojitxt-yt {
			font-size: 28rpx;
			font-family: PingFang SC-Bold, PingFang SC;
			font-weight: bold;
			color: #FF6B00;
		}
	}

	.twoviewtext {
		width: 92%;
		vertical-align: middle;
		line-height: 60rpx;
	}

	.pt90 {
		padding-top: 60rpx;
	}

	.select-type {
		width: 100%;
		padding: 30rpx;
		box-sizing: border-box;
		display: flex;
		justify-content: space-between;

		.type {
			width: 222rpx;
			height: 58rpx;
			background: #E7F6FF;
			border-radius: 76rpx 76rpx 76rpx 76rpx;
			opacity: 1;
			font-size: 26rpx;
			// font-family: PingFang SC-Regular, PingFang SC;
			font-weight: 400;
			color: #0DA0FF;
			line-height: 58rpx;
			// padding: 0 25rpx;
			box-sizing: border-box;
			// display: flex;
			position: relative;

			.typebox {
				width: 222rpx;
				// height: 174rpx;
				background: #E7F6FF;
				border-radius: 36rpx 36rpx 36rpx 36rpx;
				color: #0DA0FF;
				z-index: 99;
				margin-top: 10rpx;
				position: relative;

				.typeboxitem {
					padding: 20rpx 25rpx;
					box-sizing: border-box;
					white-space: nowrap;
					overflow: hidden;
					text-overflow: ellipsis;

					// border-bottom: 1px dashed gainsboro;
				}

			}

			.text {
				width: 150rpx;
				white-space: nowrap;
				overflow: hidden;
				text-overflow: ellipsis;
				margin-left: 25rpx;
				display: flex;
			}

			.select-img {
				width: 24rpx;
				height: 24rpx;
				display: inline-block;
				position: absolute;
				right: 25rpx;
				top: 17rpx;

			}
		}

	}

	.kemuone {
		width: 690rpx;
		margin: 0 auto;
		margin-top: 30rpx;
		// padding-right: 30rpx;
		box-sizing: border-box;
		display: flex;
		justify-content: space-between;

		.kemuone-left {
			// width: 120rpx;

			.left-box {
				width: 220rpx;
				margin-bottom: 72rpx;
				display: flex;
				flex-direction: column;
				align-items: center;
				text-align: center;

				.left-img {
					width: 80rpx;
					height: 80rpx;
				}

				.left-text {
					width: 220rpx;
					font-size: 28rpx;
					// font-family: PingFang SC-Regular, PingFang SC;
					font-weight: 400;
					color: #333333;
					line-height: 40rpx;
					margin-top: 17rpx;
					white-space: nowrap;
					overflow: hidden;
					text-overflow: ellipsis;
				}
			}
		}

		.kemuone-bot {
			width: 300rpx;
			height: 528rpx;
			display: flex;
			flex-direction: column;
			justify-content: space-between;
			// margin-left: 30rpx;
			margin-right: 10rpx;

			.bot-box {
				margin: 0 auto;
				width: 220rpx;
				height: 500rpx;
				position: relative;

				.bot-img {
					width: 235rpx;
					height: 235rpx;
					position: absolute;
					top: 0;
				}

				.kemuone-bot-lx {
					position: absolute;
					// top: 75rpx;
					// left: 52rpx;
					text-align: center;
					// padding: 0 10rpx;

					.kemuone-bot-lxnum {
						font-size: 28rpx;
						// font-family: PingFang SC-Medium, PingFang SC;
						font-weight: 500;
						color: #FFFFFF;
						line-height: 33rpx;
					}

					.kemuone-bot-lxtext {
						font-size: 32rpx;
						// font-family: PingFang SC-Medium, PingFang SC;'
						font-weight: 500;
						color: #FFFFFF;
						line-height: 45rpx;
						margin-top: 10rpx;
					}
				}
			}

		}

		.kemuone-right {
			margin-right: 30rpx;
		}

	}

	.kz .cardview button {
		padding: 5rpx 13rpx !important;
		/* line-height: 35rpx; */
		font-size: 20rpx;
	}

	.uy .cardview button {
		padding: 5rpx 13rpx !important;
		/* line-height: 35rpx; */
		font-size: 20rpx;
	}

	.daoji {
		width: 750rpx;
		height: 50rpx;
		line-height: 50rpx;
		background: #db7d7b;
		color: #ffffff;
		border-bottom: 1px solid #d02006;
		text-align: center;
	}

	.daojitxt {
		display: inline-block;
	}

	.poptitle {
		width: 750rpx;
		height: 80rpx;
		line-height: 80rpx;
	}

	.pinkbutton {
		width: 700rpx;
		margin: 0 auto;
		background: #ff3a68;
		border-radius: 200rpx;
		text-align: center;
		color: #ffffff;
	}

	.poptitle text {
		padding-left: 15rpx;
		color: #707070;
	}

	.regulations {
		display: flex;
		flex-direction: row;
		align-items: center;
		text-align: center;
		justify-content: center;
		padding: 10rpx;
		width: 700rpx;
		font-size: 14rpx;
	}

	.regulations text {
		padding-top: 7rpx;
	}

	.pink {
		color: #ff3a68;
	}

	.paytype {
		display: flex;
		flex-direction: row;
		display: flex;
		flex-direction: row;
		align-items: center;
		text-align: center;
		justify-content: space-between;
		padding: 10rpx;
		width: 700rpx;
		margin: 40rpx auto 20rpx auto;
	}

	.paytypes {
		display: flex;
		flex-direction: row;
		align-items: center;
		text-align: center;
		justify-content: space-between;
		padding: 10rpx;
		width: 700rpx;
		height: 60rpx;
		line-height: 60rpx;
		margin: 0 auto;
	}

	.payview label {
		flex-direction: row;
		display: flex;
		flex-direction: row;
		vertical-align: middle;
	}

	.payview image {
		width: 50rpx;
		height: 50rpx;
		display: inline-block;
		margin: 0 10rpx;
	}

	.payviewradio {
		display: inline-block;
		width: 40rpx;
		height: 40rpx;
		/* margin: 0 10rpx; */
		transform: scale(0.6);
	}

	.payviewradios {
		display: inline-block;

		/* margin: 0 10rpx; */
		transform: scale(0.5);
	}

	.payview text {
		display: inline-block;
	}

	.grenn {
		color: #0bd34e;
	}

	.blue {
		color: #1495d7;
	}

	.cardgroup {
		display: flex;
		flex-direction: row;
		display: flex;
		flex-direction: row;
		align-items: center;
		text-align: center;
		justify-content: space-between;
	}

	.cardview {
		padding: 10rpx;
		width: 700rpx;
		margin: 0 auto;
	}

	.cardview button {
		border: none;
	}

	.cardview button::after {
		border: none;
	}

	.cardbutton {
		border-radius: 200rpx;
		padding: 10rpx 10rpx;
		text-align: center;
		background: #f6f6f6;
		color: #707070;
		height: 80rpx;
		line-height: 80rpx;
		border: none;
		position: relative;
	}

	.cardbutton i {
		display: none;
	}

	.cardaction i {
		display: block;
		font-size: 18rpx;
		width: 80rpx;
		height: 25rpx;
		line-height: 25rpx;
		background: #ffefbe;
		color: #707070;
		position: absolute;
		top: 0rpx;
		left: 0rpx;
	}

	.cardaction {
		background: #0bd34e;
		color: #ffffff;
	}

	.banner {
		width: 730rpx;
		border-radius: 10rpx;
		padding-top: 15rpx;
		margin: 0 auto;
	}

	.switch {
		width: 750rpx;

		text-align: center;
		margin-top: 15rpx;
		margin-bottom: 30rpx;
	}

	.settingbutton {
		border-radius: 100rpx;
		display: inline-block;
		line-height: 60rpx;
		background: #0bd34e;
		color: #ffffff;
		position: relative;
	}

	.settingbutton image {
		width: 40rpx;
		height: 40rpx;
		position: absolute;
		display: inline-block;
		top: 10rpx;
		right: 20rpx;
	}

	.settingbutton text {
		display: inline-block;
		max-width: 600rpx;
		height: 60rpx;
		text-align: left;
		padding-right: 50rpx;
	}

	.kzlayout .settingbutton text {
		text-align: right;
		padding-left: 50rpx;
		padding-right: 0rpx !important;
	}

	.kzlayout .settingbutton image {
		right: auto;
		top: 14rpx;
		left: 20rpx !important;
	}

	.uylayout .settingbutton text {
		text-align: right;
		padding-left: 50rpx;
		padding-right: 0rpx !important;
	}

	.uylayout .settingbutton image {
		right: auto;
		top: 14rpx;
		left: 20rpx !important;
	}

	.twoline {
		margin-top: 50rpx;
		display: block;
		width: 680rpx;
		margin: 0 auto;
	}

	.tool {
		width: 680rpx;
		margin: 0 auto;
	}

	.group-two {
		display: flex;
		flex-direction: row;
		display: flex;
		flex-direction: row;
		align-items: center;
		text-align: center;
		justify-content: space-between;
		width: 600rpx;
		margin: 0 auto;
	}

	.twoview {
		width: 270rpx;
		/* display: inline-block; */
		height: 270rpx;
		border-radius: 100%;
		align-items: center;
		text-align: center;
		padding: 10rpx 10rpx;
		vertical-align: middle;
		display: table-cell;
	}

	.twoviewtext {
		width: 97%;
		vertical-align: middle;
		line-height: 60rpx;
	}

	.twoviewtexts {
		width: 100%;
		vertical-align: middle;
		line-height: 40rpx;
	}

	.pt90 {
		padding-top: 60rpx;
		padding-left: 18rpx;
	}

	.greenview {
		border: 8rpx solid #78fea5;
		background: #0bd34e;
		color: #ffffff;
	}

	.pinkview {
		border: 8rpx solid #ffa0b6;
		background: #ff3a68;
		color: #ffffff;
	}

	.toolsbutton {
		align-items: center;
		text-align: center;
		/* padding: 10rpx 35rpx; */
		padding-top: 20rpx;
		vertical-align: middle;
		display: table-cell;
	}

	.toolscon {
		width: 220rpx;
		display: inline-block;
		padding: 30rpx 0 0 0;
	}

	.toolicon {
		width: 100rpx;
		height: 100rpx;
		margin: 0 auto;
	}

	.toolicon image {
		width: 100rpx;
		height: 100rpx;
	}

	.tooltext {
		width: 220rpx;
		text-align: center;
		padding-top: 20rpx;
	}

	.wrap {
		display: flex;
		flex-direction: column;
		height: calc(100vh - 120px);
		width: 100%;
	}

	.swiper-box {
		flex: 1;
	}

	.swiper-item {
		height: 100%;
	}

	.popup {
		// height: 500rpx;

		.loginBox {
			width: 100%;
			height: 520rpx;
			padding: 120rpx 30rpx;
			box-sizing: border-box;

			.btnBox {
				width: 100%;
				height: 130rpx;

				.loginbtnk {
					width: 310rpx;
					margin: 10rpx;
					height: 120rpx;
					text-align: center;
					display: inline-block;
					float: left;
					margin-right: 40rpx;

				}

				.weichat {
					color: #ffffff;
					background: #0bd34e;
				}

				.loginbtnk-apple {
					color: #ffffff;
					width: 303rpx;
					height: 90rpx;
					display: inline-block;
					margin-top: 12rpx;

					.apple-img {
						width: 100%;
						height: 100%;
					}

				}


			}

			.redtext {
				color: red;
				width: 100%;
				text-align: center;
				// margin-top: 30rpx;
			}

			.login-check {
				width: 100%;
				text-align: center;
				margin: 0 auto;
				margin-top: 40rpx;
			}


		}

	}

	.drl {
		direction: rtl;
	}
</style>